function static_scroll(){
  var content_height = $('.main').height() - 500;
  var offset_scroll = 245;

  if(window.pageYOffset>offset_scroll && window.pageYOffset< content_height){
    var screensize = $(window).width();
    var mright = (screensize - 976)/2 - 15;
    $('.qc .bleft, .qc .bright').css('position','fixed');
    $('.qc .bleft, .qc .bright').css('top','0px');
  }else if(window.pageYOffset>=content_height){
    $('.qc .bleft, .qc .bright').css('top',(content_height - window.pageYOffset)+'px');
  }else{
    $('.qc .bleft, .qc .bright').css('position','');
    $('.qc .bleft, .qc .bright').css('top','');
  }
}
window.onscroll=function(oEvent){
  var isiPad = navigator.userAgent.match(/iPad/i) != null;
	if(!isiPad&&$(window).width()>=768 && $('.checkout').length == 0) static_scroll();
}
$(document).ready(function(){
  static_scroll();
  $('.tab .mtab a').click(function(){
    if($(this).hasClass('active')) return;
    var id = $(this).attr('id');
    $('.tab .mtab a').removeClass('active');
    $(this).addClass('active');
    $('.tab .mcon > div').slideUp('fast');
    $('.tab #'+'c'+id).slideDown('fast');
  });
  $('.tab #tab1').click();

  $('.stab .mtab a').click(function(){
    if($(this).hasClass('active')) return;
    var id = $(this).attr('id');
    $('.stab .mtab a').removeClass('active');
    $(this).addClass('active');
    $('.stab .mcon > div').slideUp('fast');
    $('.stab #'+'c'+id).slideDown('fast');
  });
  $('.stab #tab1').click();

  $('.main-menu div > div.container').each(function(){
    if($(this).find('div').length==0) $(this).parent().remove();
  });
  $('.content-item img').removeAttr('width').removeAttr('height');
  $('.category .sub-menu').each(function(){
    if($(this).find('.sub-menu').length==0) $(this).addClass('child');
    else $(this).addClass('parent');
  });
});
